<template>
	<view>
		<view class="help_con">
			<view class="con" v-for="(item,index) in list" :key="index"
				@click="funHref('/pages/help/help_detail?id='+item.help_id)">
				<text>{{item.help_title}}</text>
				<i class="iconfont icon-xiangyou"></i>
			</view>
		</view>
		<!--空信息-->
		<view class="nodata_con" v-if="isLoading==false&&list.length<=0">
			<label class="iconfont icon-meiyoushuju"></label>
			<text>{{$t('no_data')}}</text>
		</view>
		<!--刷新-->
		<view class='loadind_con' v-if="isLoading">
			<view class="loading">
				<view class="loading-bar"></view>
				<view class="loading-bar"></view>
				<view class="loading-bar"></view>
				<view class="loading-bar"></view>
			</view>
		</view>
	</view>
</template>

<script>
	import valid from '../../static/valid.js';

	export default {
		data() {
			return {
				index: 1, //页数
				size: 10, //条数
				list: [], //列表值
				isLoading: true, //是否正在加载
			}
		},
		onReady() {
			uni.setNavigationBarTitle({
				title: this.$t('help')
			})
		},
		onLoad() {
			var _this = this;
			//加载列表
			_this.getData();
		},
		onPullDownRefresh() { //下拉刷新
			var _this = this;
			//清空还原
			_this.index = 1;
			_this.list = [];
			_this.isLoading = true;
			_this.getData();
		},
		onReachBottom() { //上拉到底部刷新
			var _this = this;
			_this.index = _this.index + 1;
			_this.isLoading = true;
			_this.getData();
		},
		methods: {
			getData: function() { //获取内容
				var _this = this;
				_this.fun_request("/Api/Help/GetPageList", {
					index: _this.index,
					size: _this.size,
					count: 0
				}, function(res) {
					console.log(res);
					var _list = res.data;
					_this.list = _this.list.concat(_list);
					//加载完成
					_this.isLoading = false;
					//下拉刷新 - 停止
					uni.stopPullDownRefresh();
				});
			},
			funHref: function(url) { //跳转
				this.fun_navigateTo(url);
			},
		}
	}
</script>

<style lang="scss">
	page {
		background: #F7F7F7;
	}

	.help_con {
		width: 94%;
		margin: 30rpx 3%;

		view.con {
			margin-bottom: 30rpx;
			background-color: #fff;
			border-radius: 15rpx;
			padding: 0 3%;
			height: 100rpx;
			line-height: 100rpx;
			overflow: hidden;

			text {
				float: left;
				color: #333;
				width: 90%;
			}

			i {
				float: right;
				font-size: 34rpx;
			}
		}
	}
</style>
